package com.android.taobao.client;

import com.android.taobao.common.Common;
import com.taobao.api.TaobaoApiException;
import com.taobao.api.TaobaoJsonRestClient;

/**
 * 封装TAOBAO客户端，单例模式
 * @author Bobby.Jin
 *
 */
public class CommonClient {
	private static TaobaoJsonRestClient client;

	private CommonClient() {
	}

	/**
	 * singleton client
	 * 
	 * @return
	 */
	public synchronized static TaobaoJsonRestClient getInstance() {
		if (client == null) {
			try {
				client = new TaobaoJsonRestClient(Common.TEST_URL,
						Common.APP_KEY, Common.APP_SECRET);
			} catch (TaobaoApiException e) {
				e.printStackTrace();
			}
		}
		return client;
	}
}